/*年轻人，只管向前看，不要管自暴自弃者的话*/
package com.znb.okdown.ui.base

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.znb.okdown.databinding.ActivityBaseBinding
import com.znb.okdown.util.StatusBar


/**
 * create by itz on 2024/1/18 17:20
 * desc :
 **/
open class BaseActivity : AppCompatActivity() {

    lateinit var baseBinding: ActivityBaseBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        baseBinding = ActivityBaseBinding.inflate(layoutInflater)
        setContentView(baseBinding.root)
        StatusBar.fullScreen(this, false)
        StatusBar.setAndroidNativeLightStatusBar(this, false)
        init()
    }

    private fun init() {
        baseBinding.apply {
            ivBaseBack.setOnClickListener {
                onBackClick()
            }

            ivRightIcon.setOnClickListener {
                onRightTopMenuClick()
            }

            tvRightTitle.setOnClickListener {
                onRightTopMenuClick()
            }
        }
    }

    fun setActivityTitle(title: String) {
        baseBinding.tvBaseTitle.text = title
    }

    fun setBaseContentView(contentView: View) {
        baseBinding.baseContent.addView(contentView)
    }

    fun onBackClick() {
        finish()
    }

    fun onRightTopMenuClick() {

    }

    override fun onBackPressed() {
        super.onBackPressed()
        finish()
    }

}